/*    */ package com.sina.weibo4j.http;
/*    */ 
/*    */ import java.io.File;
/*    */ 
/*    */ public class FileType
/*    */ {
/* 27 */   private final String[][] MIME_MapTable = { 
/* 28 */     { ".3gp", "video/3gpp" }, 
/* 29 */     { ".apk", "application/vnd.android.package-archive" }, 
/* 30 */     { ".asf", "video/x-ms-asf" }, 
/* 31 */     { ".avi", "video/x-msvideo" }, 
/* 32 */     { ".bin", "application/octet-stream" }, 
/* 33 */     { ".bmp", "image/bmp" }, 
/* 34 */     { ".c", "text/plain" }, 
/* 35 */     { ".class", "application/octet-stream" }, 
/* 36 */     { ".conf", "text/plain" }, 
/* 37 */     { ".cpp", "text/plain" }, 
/* 38 */     { ".doc", "application/msword" }, 
/* 39 */     { ".exe", "application/octet-stream" }, 
/* 40 */     { ".gif", "image/gif" }, 
/* 41 */     { ".gtar", "application/x-gtar" }, 
/* 42 */     { ".gz", "application/x-gzip" }, 
/* 43 */     { ".h", "text/plain" }, 
/* 44 */     { ".htm", "text/html" }, 
/* 45 */     { ".html", "text/html" }, 
/* 46 */     { ".jar", "application/java-archive" }, 
/* 47 */     { ".java", "text/plain" }, 
/* 48 */     { ".jpeg", "image/jpeg" }, 
/* 49 */     { ".jpg", "image/jpeg" }, 
/* 50 */     { ".js", "application/x-javascript" }, 
/* 51 */     { ".log", "text/plain" }, 
/* 52 */     { ".m3u", "audio/x-mpegurl" }, 
/* 53 */     { ".m4a", "audio/mp4a-latm" }, 
/* 54 */     { ".m4b", "audio/mp4a-latm" }, 
/* 55 */     { ".m4p", "audio/mp4a-latm" }, 
/* 56 */     { ".m4u", "video/vnd.mpegurl" }, 
/* 57 */     { ".m4v", "video/x-m4v" }, 
/* 58 */     { ".mov", "video/quicktime" }, 
/* 59 */     { ".mp2", "audio/x-mpeg" }, 
/* 60 */     { ".mp3", "audio/x-mpeg" }, 
/* 61 */     { ".mp4", "video/mp4" }, 
/* 62 */     { ".mpc", "application/vnd.mpohun.certificate" }, 
/* 63 */     { ".mpe", "video/mpeg" }, 
/* 64 */     { ".mpeg", "video/mpeg" }, 
/* 65 */     { ".mpg", "video/mpeg" }, 
/* 66 */     { ".mpg4", "video/mp4" }, 
/* 67 */     { ".mpga", "audio/mpeg" }, 
/* 68 */     { ".msg", "application/vnd.ms-outlook" }, 
/* 69 */     { ".ogg", "audio/ogg" }, 
/* 70 */     { ".pdf", "application/pdf" }, 
/* 71 */     { ".png", "image/png" }, 
/* 72 */     { ".pps", "application/vnd.ms-powerpoint" }, 
/* 73 */     { ".ppt", "application/vnd.ms-powerpoint" }, 
/* 74 */     { ".prop", "text/plain" }, 
/* 75 */     { ".rar", "application/x-rar-compressed" }, 
/* 76 */     { ".rc", "text/plain" }, 
/* 77 */     { ".rmvb", "audio/x-pn-realaudio" }, 
/* 78 */     { ".rtf", "application/rtf" }, 
/* 79 */     { ".sh", "text/plain" }, 
/* 80 */     { ".tar", "application/x-tar" }, 
/* 81 */     { ".tgz", "application/x-compressed" }, 
/* 82 */     { ".txt", "text/plain" }, 
/* 83 */     { ".wav", "audio/x-wav" }, 
/* 84 */     { ".wma", "audio/x-ms-wma" }, 
/* 85 */     { ".wmv", "audio/x-ms-wmv" }, 
/* 86 */     { ".wps", "application/vnd.ms-works" }, 
/* 87 */     { ".xml", "text/xml" }, 
/* 88 */     { ".xml", "text/plain" }, 
/* 89 */     { ".z", "application/x-compress" }, 
/* 90 */     { ".zip", "application/zip" }, 
/* 91 */     { "", "*/*" } };
/*    */ 
/*    */   public String getMIMEType(File file)
/*    */   {
/* 12 */     String type = "*/*";
/* 13 */     String fName = file.getName();
/* 14 */     int dotIndex = fName.lastIndexOf(".");
/* 15 */     if (dotIndex < 0) {
/* 16 */       return type;
/*    */     }
/* 18 */     String end = fName.substring(dotIndex, fName.length()).toLowerCase();
/* 19 */     if (end == "") return type;
/* 20 */     for (int i = 0; i < this.MIME_MapTable.length; i++) {
/* 21 */       if (end.equals(this.MIME_MapTable[i][0]))
/* 22 */         type = this.MIME_MapTable[i][1];
/*    */     }
/* 24 */     return type;
/*    */   }
/*    */ }